﻿@page
@model AdminUI.Pages.Mall.OrderDetailsModel
@{
    var F = Html.F();
    //var goodsName = $"{Model.Current.GoodsID}-{Model.Current.GoodsName}";
    var reco = Model.Current.RecoID > 0 ? $"{Model.Current.RecoID}-{Model.Current.RecoName}" : "无";
    var reco2 = Model.Current.RecoID2 > 0 ? $"{Model.Current.RecoID2}-{Model.Current.RecoName2}" : "无";
    var agent = Model.Current.AgentID > 0 ? $"{Model.Current.AgentID}-{Model.Current.AgentName}" : "无";
    var buyer = $"{Model.Current.UserID}-{Model.Current.UserType}-{Model.Current.TrueName}-{Model.Current.Mobile}";
    var receiver = $"{Model.Current.ReceiverName}-{Model.Current.ReceiverPhone}-{Model.Current.ReceivingAddress}";

}

@section body {
    <f:Form ID="Form1" ShowBorder="false" ShowHeader="false" AutoScroll="true" BodyPadding="15" IsViewPort="true">
        <Rows>
            <f:FormRow ColumnWidths="25% 25% 25% 25%">
                <Items>
                    <f:TextBox ID="OrderID" Required="false" Label="订单ID" Text="@Model.Current.OrderID" Readonly="true"></f:TextBox>
                    <f:TextBox ID="CountyID" Label="区县ID" Text="@Model.Current.CountyID" Readonly="true"></f:TextBox>
                    <f:TextBox ID="CreateTime" Label="创建时间" Text="@Model.Current.CreateTime" Readonly="true"></f:TextBox>
                    <f:DropDownList ID="Status" Label="订单状态" SelectedValue="@Model.Current.Status" Readonly="true">
                        <f:ListItem Text="10-待付款" Value="10" />
                        <f:ListItem Text="11-已取消" Value="11" />
                        <f:ListItem Text="20-待审核" Value="20" />
                        <f:ListItem Text="30-待发货" Value="30" />
                        <f:ListItem Text="100-已完成" Value="100" />
                    </f:DropDownList>
                </Items>
            </f:FormRow>
            <f:FormRow ColumnWidths="50% 50%">
                <Items>
                    <f:TextBox ID="UserID" Label="会员信息" Text="@buyer" Readonly="true"></f:TextBox>
                    <f:TextBox ID="Receiver" Label="收件人信息" Text="@receiver" Readonly="true"></f:TextBox>
                </Items>
            </f:FormRow>
            <f:FormRow ColumnWidths="25% 25% 25% 25%">
                <Items>
                    <f:TextBox ID="RecoID" Label="直推会员" Text="@reco" Readonly="true"></f:TextBox>
                    <f:TextBox ID="L1Fee" Label="直推奖励" Text="@Model.Current.L1Fee" Readonly="true"></f:TextBox>
                    <f:TextBox ID="RecoID2" Label="间推会员" Text="@reco2" Readonly="true"></f:TextBox>
                    <f:TextBox ID="L2Fee" Label="间推奖励" Text="@Model.Current.L2Fee" Readonly="true"></f:TextBox>
                </Items>
            </f:FormRow>
            <f:FormRow ColumnWidths="25% 25% 50%">
                <Items>
                    <f:TextBox ID="AgentID" Label="代理会员" Text="@agent" Readonly="true"></f:TextBox>
                    <f:TextBox ID="Commission" Label="业绩提成" Text="@Model.Current.Commission" Readonly="true"></f:TextBox>
                    <f:TextBox ID="ExpressCompany" Label="物流信息" Text="@Model.Current.ExpressCompany - @Model.Current.ExpressNo" Readonly="true"></f:TextBox>
                </Items>
            </f:FormRow>
            <f:FormRow ColumnWidths="25% 25% 25% 25%">
                <Items>
                    <f:TextBox ID="Total" Label="商品总数" Text="@Model.Current.Total" Readonly="true"></f:TextBox>
                    <f:TextBox ID="Amount" Label="订单金额" Text="@Model.Current.Amount" Readonly="true"></f:TextBox>
                    <f:TextBox ID="DeductionAmount" Label="余额抵扣" Text="@Model.Current.DeductionAmount" Readonly="true"></f:TextBox>
                    <f:TextBox ID="Cost" Label="订单成本" Text="@Model.Current.Cost" Readonly="true"></f:TextBox>
                </Items>
            </f:FormRow>
            <f:FormRow ColumnWidths="50% 50%">
                <Items>
                    <f:TextBox ID="PayeeAccount" Label="收款账号" Text="@Model.Current.PayeeAccount" Readonly="true"></f:TextBox>
                    <f:TextBox ID="TradeNo" Label="交易流水号" Text="@Model.Current.TradeNo" Readonly="true"></f:TextBox>
                </Items>
            </f:FormRow>
            <f:FormRow ColumnWidths="25% 75%">
                <Items>
                    <f:DatePicker ID="TransferDate" Label="转账日期" DateFormatString="yyyy-MM-dd" EnableEdit="false" Readonly="true" SelectedDate="@Model.Current.TransferDate"></f:DatePicker>
                    <f:TextBox ID="TransferMemo" Label="转账备注" Text="@Model.Current.TransferMemo" Readonly="true"></f:TextBox>
                </Items>
            </f:FormRow>
            <f:FormRow ColumnWidths="25% 25% 25% 25%">
                <Items>
                    <f:TextBox ID="AuditorID" Label="审核员" Text="@Model.Current.AuditorID - @Model.Current.AuditorName" Readonly="true"></f:TextBox>
                    <f:DatePicker ID="AuditingTime" Label="审核时间" DateFormatString="yyyy-MM-dd" EnableEdit="false" Readonly="true" SelectedDate="@Model.Current.AuditingTime"></f:DatePicker>
                    <f:TextBox ID="ShipperID" Label="发货人" Text="@Model.Current.ShipperID - @Model.Current.ShipperName" Readonly="true"></f:TextBox>
                    <f:DatePicker ID="DeliveryTime" Label="发货时间" DateFormatString="yyyy-MM-dd" EnableEdit="false" Readonly="true" SelectedDate="@Model.Current.DeliveryTime"></f:DatePicker>
                </Items>
            </f:FormRow>
            <f:FormRow ColumnWidths="100%">
                <Items>
                    <f:Grid ID="Grid1" BoxFlex="1" ShowBorder="true" ShowHeader="true" EnableTextSelection="true" EnableColumnLines="true"
                            DataIDField="OrderItemID" DataTextField="GoodsName" DataSource="@ViewBag.OrderItems" Title="订单商品列表">
                        <Columns>
                            <f:RenderField HeaderText="订单项ID" DataField="OrderItemID" FieldType="Int" Width="130" TextAlign="Center" />
                            <f:RenderField HeaderText="商品ID" DataField="GoodsID" FieldType="Int" Width="100" TextAlign="Center" />
                            <f:RenderField HeaderText="商品名称" DataField="GoodsName" Width="240" Hidden="false" />
                            <f:RenderField HeaderText="类别" DataField="CategoryName" Width="120" Hidden="false" />
                            <f:RenderField HeaderText="数量" DataField="Num" FieldType="Int" Width="80" TextAlign="Right" />
                            <f:RenderField HeaderText="售价" DataField="Price" FieldType="Double" Width="80" TextAlign="Right" />
                            <f:RenderField HeaderText="成本价" DataField="CostPrice" FieldType="Double" Width="100" TextAlign="Right" />
                            <f:RenderField HeaderText="市场价" DataField="MarketPrice" FieldType="Double" Width="100" TextAlign="Right" />
                        </Columns>
                    </f:Grid>
                </Items>
            </f:FormRow>
        </Rows>
    </f:Form>


}

@section script {
    <script src="~/res/js/grid.js"></script>
    <script>
        function renderItem(value, params) {
            return value + "-" + params.rowData.values.ItemName;
        }
        function renderStatus(value, params) {
            switch (value) {
                case 1:
                    return "<span class='tag-default'>待使用</span>";
                case 2:
                    return "<span class='tag-success'>已使用</span>";
                default:
                    return "-";
            }
        }

    </script>
}
